package variable

import (
	"fmt"
	"reflect"
)

// AppName 大写的变量可以被包外部访问
var AppName = "chihuo"

// appVersion 小写是私有变量
var appVersion = "1.0.0"

func init() {
	var (
		a string
		b int
		c bool
		d float32
	)
	fmt.Println("default variable")
	fmt.Println("default string:", a)
	fmt.Println("default int:", b)
	fmt.Println("default bool:", c)
	fmt.Println("default float32:", d)

	//类型推导
	var name = "pprof.cn"
	var sex = 1
	//:=不能用在函数外
	m := 10
	height := 1.99
	fmt.Println(reflect.TypeOf(name))
	fmt.Println(reflect.TypeOf(sex))
	fmt.Println(reflect.TypeOf(m))
	fmt.Println(reflect.TypeOf(height))

	const pi = 3.14159
	const e = 2.7182
	const (
		n1 = 100
		n2
		n3
	)
	fmt.Println(n1, n2, n3)
	const (
		n10 = iota
		n11 = 100
		n12 = iota
		_
		n13
	)
	const n14 = iota
	fmt.Println(n10, n11, n12, n13, n14)

	//fmt.Println(0===false)
	s1 := `第一行
	第二行
	第三行
    `
	fmt.Println(s1)
	fmt.Println("-----------")
}
